<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<%@ taglib prefix="ujn" uri="http://ujn.edu.cn/common/"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName()
          + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML>
<html>
<!--用户导航栏-->
<!--请勿随意修改该 demo 文件, 请复制后修改名称使用-->
<!--该 demo 仅规定了导航栏样式，css文件入js文件均不齐全，请根据需要添加-->
<!--css和 js具体添加方式和缺少文件参考老师发的 lab3 或 exam3 -->
<!--其他未尽事宜请阅读《停车场.md》文件-->

<head>
  <title>demo.jsp</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <!-- 引入css样式文件 -->
  <!-- Bootstrap Core CSS -->
  <link href="<%=basePath%>css/bootstrap.css" rel="stylesheet" />
  <!-- Bootstrap-grid CSS -->
  <link href="<%=basePath%>css/bootstrap-grid.css" rel="stylesheet" />
  <!-- Bootstrap-reboot CSS -->
  <link href="<%=basePath%>css/bootstrap-reboot.css" rel="stylesheet" />
</head>
<body>

<div>
  <nav class="navbar navbar-expand-lg navbar-dark " style="background-color:#81D8CF;;">
      <img src="imges/logo.jpg" class="rounded float-left" alt="Logo" height="45" width="45">
    <div class="container" style="">
      <a class="navbar-brand" href="#">停车场管理系统</a>
      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText"
              aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarText">
          <ul class="navbar-nav mr-auto">
              <li class="nav-item">
                  <a class="nav-link " href="${pageContext.request.contextPath }/user">用户信息</a>
              </li>
              <li class="nav-item">
                  <a class="nav-link " href="${pageContext.request.contextPath }/book">预定信息</a>
              </li>
              <a class="nav-link" href="${pageContext.request.contextPath }/parking_record">车辆进出</a>
              </li>
              <li class="nav-item">
                  <a class="nav-link " href="${pageContext.request.contextPath }/parking_space_manage">停车位管理</a>
              </li>
              <li class="nav-item">
                  <a class="nav-link" href="${pageContext.request.contextPath }/rate">收费标准</a>
              </li>
              <li class="nav-item">
                  <a class="nav-link active" href="${pageContext.request.contextPath }/adminequip">设备管理</a>
              </li>
              <li class="nav-item">
                  <a class="nav-link" href="${pageContext.request.contextPath}/vehicle">车辆信息</a>
              </li>
          </ul>
        <span class="navbar-text">
          导航栏
        </span>
      </div>
    </div>
  </nav>
</div>
<div class="container">
    <h1><a href="${pageContext.request.contextPath }/adminequip">设备管理</a><a href="${pageContext.request.contextPath }/adminmaintenance">设备投诉</a>用户意见</h1>
    <div class="p-2 bg-light border">
       <table class="table table-bordered table-striped">
       	<thead>
       		<tr>
       			<th>编号</th>
       			<th>用户编号</th>
       			<th>意见内容</th>
       			<th>建议时间</th>
       			<th>处理状态</th>
       			<th>操作</th>
       		</tr>
       	</thead>
       	<tbody>
       	    <c:forEach items="${page.rows}" var="row">
       			<tr>
       				<td>${row.feedBackId}</td>
       				<td>${row.userId}</td>
       				<td>${row.content}</td>
       				<td>${row.submissionTime}</td>
       				<td>${row.status}</td>
       				<td><center>
       					<a href="${pageContext.request.contextPath}/handlefeedback?&feedBackId=${row.feedBackId}" class="btn btn-primary">处理完成</a>
       					<a href="#" class="btn btn-danger btn-xs" onclick="deleteFeedBack(${row.feedBackId})">删除</a>
       				</td>
       			</tr>
       		</c:forEach>
       	</tbody>
       </table>
               <div class="col-md-12 text-right">
                    <ujn:page url="${pageContext.request.contextPath }/adminfeedback"/>
                </div>
    </div>
</div>
<!-- 引入js文件 -->
<script src="<%=basePath%>js/jquery-1.11.3.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="<%=basePath%>js/bootstrap.js"></script>
<!-- Bootstrap-bundle JavaScript -->
<script src="<%=basePath%>js/bootstrap.bundle.js"></script>
<!-- Metis Menu Plugin JavaScript -->
<script src="<%=basePath%>js/metisMenu.min.js"></script>
<!-- DataTables JavaScript -->
<script src="<%=basePath%>js/jquery.dataTables.min.js"></script>
<script src="<%=basePath%>js/dataTables.bootstrap.min.js"></script>
<!-- Custom Theme JavaScript -->
<script src="<%=basePath%>js/sb-admin-2.js"></script>
<!-- 编写js代码 -->
<script type="text/javascript">
    // 删除
    function deleteFeedBack(id) {
        if (confirm('确实要删除该记录吗?')) {
            $.ajax({
                url: '<%=basePath%>feedback/' + id,
                type: 'DELETE',
                success: function (data) {
                    if (data == "OK") {
                        alert("记录信息删除成功！");
                        window.location.reload();
                    } else {
                        alert("记录信息删除失败，请删除已处理的记录！");
                        window.location.reload();
                    }
                }
            });
        }
    }
</script>
</body>
</html>
